<!--
 * @Description: 
 * @Autor: Zhu_liangyu
 * @Date: 2020-05-31 17:28:39
--> 
<template>
  <div>
    <page-table
      rowKey="anonymousId"
      ref="anonymousPageTable"
      :query-api="anonymous_queryPageApi"
      :delete-api="anonymous_deletesApi"
      :columns="columns"
      :query-param="queryParam"
      :search-data="searchData"
      @addClick="addAnonymousForm"
    >
      <template #customUrl="{text,record}">
        <!-- <router-link :to="anonymousFormUrl+'/'+record.anonymousId">
          <span>{{text}}</span>
        </router-link>-->
        <qc-link @click="editAnonymousForm(record)">{{text}}</qc-link>
      </template>
    </page-table>
    <a-modal
      title="匿名访问详情"
      :visible="visible"
      @cancel="()=>{visible=false;currentAnonymousId=null;this.reloadTable()}"
      :footer="null"
    >
      <anonymous-form :anonymous-id="currentAnonymousId" v-if="visible"></anonymous-form>
    </a-modal>
  </div>
</template>

<script>
import {
  anonymousFormUrl,
  anonymous_queryPageApi,
  anonymous_deletesApi,
} from "@/api/org/anonymous";
import {
  anonymousTableColumns,
  anonymousQueryColumns,
} from "@/profile/org/anonymous";
import AnonymousForm from "@/views/org/anonymous/form";
export default {
  components: { AnonymousForm },
  data() {
    return {
      columns: anonymousTableColumns,
      searchData: anonymousQueryColumns,
      queryParam: {},
      anonymousFormUrl,
      anonymous_queryPageApi,
      anonymous_deletesApi,
      currentAnonymousId: null,
      visible: false,
    };
  },
  methods: {
    reloadTable() {
      this.$refs.anonymousPageTable.reload();
    },
    addAnonymousForm() {
      this.visible = true;
    },
    editAnonymousForm(record) {
      this.currentAnonymousId = record.anonymousId;
      this.visible = true;
    },
  },
};
</script>